#ifndef DBPAGE_H
#define DBPAGE_H


#include <QtGui>
#include "customsqlmodel.h"
class DbPage
{
public:
    DbPage();
    CustomSqlModel* search(QString ,int,QString);
    int page, records, first, previous, next, last, total;
    QString searchText, sql, whereSql, orderbySql;
    QStringList columnList,headerList;
    bool firstOk();
    bool previousOk();
    bool nextOk();
    bool lastOk();
    int previousPage();
    int nextPage();
    int lastPage();

private:
    CustomSqlModel *model;
    QString table, columns, headers, orderby;
    QString createSql();
    CustomSqlModel* search();
    int searchCount();
    void connect();
    bool isValid();
};

#endif // DBPAGE_H
